﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace H5.FIO {

    /// <summary>
    /// SqlDataReaderExtensions 的摘要说明
    /// </summary>
    public static class SqlDataReaderExtensions {

        public static string getString(this SqlDataReader reader, string fieldName) {
            var i = reader.GetOrdinal(fieldName);
            return reader.IsDBNull(i) ? null : reader.GetString(i);
        }

        public static string getStringNonNull(this SqlDataReader reader, string fieldName) {
            var i = reader.GetOrdinal(fieldName);
            return reader.IsDBNull(i) ? String.Empty : reader.GetString(i) ?? String.Empty;
        }

    }

}